package com.online.studyonline.controller;

import com.online.studyonline.pojo.Result;
import com.online.studyonline.pojo.Video;
import com.online.studyonline.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@RestController
@CrossOrigin
@RequestMapping("/video")
public class VideoController {
    @Autowired
    private VideoService videoService;
    @GetMapping("/getVideoList")
    public Result getVideoList(@RequestParam("courseId") Integer courseId){
        List<Video> videoList = videoService.lambdaQuery().eq(Video::getCourseId, courseId).list();
        return Result.success(videoList);
    }
    @GetMapping("/getVideoById")
    public Result getVideoById(@RequestParam("videoId") Integer videoId){
        Video video = videoService.getById(videoId);
        return Result.success(video);
    }
}
